<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>${merchantVO.uname }商家详情</title>
<script src="../js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="../css/bootstrap-responsive.min.css" />
<link rel="stylesheet" type="text/css" href="../css/bootstrap-theme.min.css" />
<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css" />
<style type="text/css">
#merchant {
	font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
	width: 25%;
	border-collapse: collapse;
	table-layout: fixed;
}

td {
	overflow: hidden;
}


.title {
	text-align: right;
	margin-right: 40px;
	margin-top: 20px
}

</style>
</head>
<body style="font-size: 16px;">
	<div class="title">
		<b>管理员:${manager.uname }</b>
	</div>
	<div align="center">
		<form
			action="changeStatus?status=3&id=${merchantVO.id }&oldStatus=${merchantVO.status }"
			method="post">
			<table border="2" cellpadding="5"
				style="margin-top: 100px; text-align: right; border-style: none;"
				id="merchant" class="table table-bordered">

				<tr>
					<td colspan="4" align="left" style="border: none;"><h1>商家详情：</h1></td>
				</tr>

				<tr>
					<td colspan="3" rowspan="2"><center>
							<img alt="IDCart" src="image?id=${merchantVO.id }&type=idcard"
								style="display: block; height: 150px; width: 100%">
						</center></td>
					<td align="center" colspan="1" height="10">PORTRAIT</td>
				</tr>

				<tr>
					<td height="70" width="50px"><center>
							<img alt="头像" src="image?id=${merchantVO.id }&type=portrait"
								style="display: block; width: 100%; height: 100%">
						</center></td>
				</tr>
				<tr>
					<td>姓名:</td>
					<td colspan="3">${merchantVO.uname }</td>
				</tr>
				<tr>
					<td>地址:</td>
					<td colspan="3">${merchantVO.address }</td>
				</tr>
				<tr>
					<td>审核状态：</td>
					<td colspan="3"><c:if test="${merchantVO.status==0 }">
							未审核
						</c:if> <c:if test="${merchantVO.status==3 }">
							驳回
						</c:if></td>
				</tr>

				<c:if test="${merchantVO.status == 0}">
					<tr>
						<td valign="top"><font color="red">*${error }</font>驳回理由：</td>
						<td colspan="3"><textarea rows="5"
								style="height: 100%; width: 95%" name="failReason"></textarea></td>
					</tr>
				</c:if>
				<c:if test="${merchantVO.status == 3 }">
					<tr>
						<td valign="top">驳回理由：</td>
						<td colspan="3">${merchantVO.reasonContent }</td>
					</tr>
				</c:if>

				<tr>
					<c:if test="${merchantVO.status== 0 }">
						<td colspan="4">
							<center>
								<input type="submit" value="驳回" class="btn btn-primary"> <a
									class="btn btn-primary" href="changeStatus?status=1&id=${merchantVO.id }">通过</a>
								<a class="btn btn-primary" href="getMerchantList?action=search&status=0">返回</a>
							</center>
						</td>
					</c:if>
					<c:if test="${merchantVO.status == 3 }">
						<td colspan="4"><center>
								<a class="btn btn-primary" href="getMerchantList?action=search&status=3">返回</a>
							</center></td>
					</c:if>
				</tr>
			</table>
		</form>
	</div>
	<script type="text/javascript">
		window.onload = function() {
			var time = "${merchantVO.time }";
			var id = "${merchantVO.id}";
			
			function send() {
				var uri = "../update?id=" + id
						+ "&time=" + time;
				$.ajax({
					Type : "GET",
					url : uri,
					success:function(){
					
					}
				}).done(function(msg) {
					
					if (msg) {
						alert("商家信息已更新，正在更新页面!");
						location.href="getMerchantDetails?id=${merchantVO.id }&status=0";
						
					}
				});
			}
			
			setInterval(send,3000);

		};
	</script>
</body>
</html>